package util

import (
	"math/rand"
	"time"
)

//三目运算
func If(condition bool, trueVal, falseVal interface{}) interface{} {
	if condition {
		return trueVal
	}
	return falseVal
}


func RandomString(n int) string {
	var letters = []byte("abcdefghijkmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ")
	result := make([]byte, n)
	rand.Seed(time.Now().Unix())

	for key := range result {
		result[key] = letters[rand.Intn(len(letters))]
	}
	return string(result)
}
